﻿using Md.Api.Model.Im.Request;
using Md.Im.Service;

namespace Md.Api.Service.Im;
/// <summary>
/// Im连接服务
/// </summary>
public class ImConnectService : ApiBase<RequestImConnectModel>
{
    /// <summary>
    /// 执行
    /// </summary>
    protected override void ExecuteMethod()
    {
        if (Parameter.ClientId == null) Parameter.ClientId = Guid.NewGuid();

        var wsServer = ImHelper.PrevConnectServer(Parameter.ClientId.Value, Parameter.UserId, "127.0.0.1:5800");

        var channelName = "adv_md_ys";

        // server(ws连接地址)、clientId(客户端编号)、channelName(频道名称)
        Result.Data = new { Server = wsServer, Parameter.ClientId, channelName };
    }
}

